'''
/*
 * @Author: wevsmy 
 * @Date: 2017-10-30 18:06:47 
 * @Last Modified by: wevsmy
 * @Last Modified time: 2017-10-30 18:07:22
 */
'''
from greenlet import greenlet
import time

def test1():
    while True:
        print("---A--")
        gr2.switch()
        time.sleep(0.5)

def test2():
    while True:
        print("---B--")
        gr1.switch()
        time.sleep(0.5)

gr1 = greenlet(test1)
gr2 = greenlet(test2)

#切换到gr1中运行
gr1.switch()